package com.sleep.ruledemo.service.imol;

import com.sleep.ruledemo.domian.DemoEvent;
import com.sleep.ruledemo.service.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Objects;

/**
 * @author GuoAo
 * @className UserServiceImpl
 * @date 2025/3/20
 * @description TODO
 */
@Service("userService")
@Slf4j
@Order(1)
public class UserServiceImpl implements DemoService<String,String> {
    @Override
    public boolean handle(DemoEvent event) {
        return Objects.equals(event.getType(),"userService");
    }

    @Override
    public Map<String, String> execute(DemoEvent event) {
        log.info("UserServiceImpl.execute: " + event.getName());
        return Map.of("userName", event.getName());
    }
}
